define(['module', 'react', 'react-dom', "./Tile", "Spin", "Button", "Switch", "FontIcon"], function (module, React, ReactDOM, Tile, Spin, Button, Switch, FontIcon) {
    'use strict';

    function _classCallCheck(instance, Constructor) {
        if (!(instance instanceof Constructor)) {
            throw new TypeError("Cannot call a class as a function");
        }
    }

    var _createClass = function () {
        function defineProperties(target, props) {
            for (var i = 0; i < props.length; i++) {
                var descriptor = props[i];
                descriptor.enumerable = descriptor.enumerable || false;
                descriptor.configurable = true;
                if ("value" in descriptor) descriptor.writable = true;
                Object.defineProperty(target, descriptor.key, descriptor);
            }
        }

        return function (Constructor, protoProps, staticProps) {
            if (protoProps) defineProperties(Constructor.prototype, protoProps);
            if (staticProps) defineProperties(Constructor, staticProps);
            return Constructor;
        };
    }();

    function _possibleConstructorReturn(self, call) {
        if (!self) {
            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
        }

        return call && (typeof call === "object" || typeof call === "function") ? call : self;
    }

    function _inherits(subClass, superClass) {
        if (typeof superClass !== "function" && superClass !== null) {
            throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
        }

        subClass.prototype = Object.create(superClass && superClass.prototype, {
            constructor: {
                value: subClass,
                enumerable: false,
                writable: true,
                configurable: true
            }
        });
        if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
    }

    var Component = React.Component;

    var WaterSpin = Spin.WaterSpin;
    var SVGSpin = Spin.SVGSpin;
    var CssSpin = Spin.CssSpin;
    var GIFSpin = Spin.GIFSpin;

    var Page = function (_Component) {
        _inherits(Page, _Component);

        function Page() {
            _classCallCheck(this, Page);

            return _possibleConstructorReturn(this, Object.getPrototypeOf(Page).apply(this, arguments));
        }

        _createClass(Page, [{
            key: 'componentDidMount',
            value: function componentDidMount() {
                for (var i in this.refs) {
                    var ref = this.refs[i];
                    var block = ReactDOM.findDOMNode(ref);
                    SyntaxHighlighter.highlight({}, block);
                }
            }
        }, {
            key: 'plus',
            value: function plus() {
                var percent = this.refs.waterSpin.getPercent();
                if (percent < 100) {
                    this.refs.waterSpin.setPercent(percent + 10);
                }
            }
        }, {
            key: 'substract',
            value: function substract() {
                var percent = this.refs.waterSpin.getPercent();
                if (percent > 0) {
                    this.refs.waterSpin.setPercent(percent - 10);
                }
            }
        }, {
            key: 'switchSpin',
            value: function switchSpin(value) {
                if (value) {
                    this.refs.svg_spin.show();
                } else {
                    this.refs.svg_spin.hide();
                }
            }
        }, {
            key: 'render',
            value: function render() {
                return React.createElement(
                    'div',
                    { className: 'container' },
                    React.createElement(
                        'div',
                        { style: { background: "#1d1f20" } },
                        React.createElement(WaterSpin, { ref: 'waterSpin', percent: '50' }),
                        React.createElement(
                            Button,
                            { theme: 'primary', onClick: this.plus.bind(this) },
                            '+'
                        ),
                        React.createElement(
                            Button,
                            { theme: 'primary', onClick: this.substract.bind(this) },
                            '-'
                        ),
                        React.createElement(WaterSpin, { size: 150, percent: '50' })
                    ),
                    React.createElement(
                        SVGSpin,
                        { ref: 'svg_spin', className: 'mt-20' },
                        React.createElement(
                            'div',
                            { style: { height: 100, position: "relative", backgroundColor: "#ecf6fd", border: "1px solid #d2eafb" } },
                            React.createElement(
                                'strong',
                                null,
                                'Alert message title'
                            ),
                            React.createElement(
                                'p',
                                null,
                                'Further details about the context of this alert.'
                            )
                        )
                    ),
                    React.createElement(Switch, { className: 'mt-20', theme: 'primary', value: '0', onChange: this.switchSpin.bind(this) }),
                    React.createElement(
                        CssSpin,
                        { className: 'mt-20', spinning: true, type: 'mask' },
                        React.createElement(
                            'div',
                            { style: { height: 100, position: "relative", backgroundColor: "#ecf6fd", border: "1px solid #d2eafb" } },
                            React.createElement(
                                'strong',
                                null,
                                'Alert message title'
                            ),
                            React.createElement(
                                'p',
                                null,
                                'Further details about the context of this alert.'
                            )
                        )
                    ),
                    React.createElement(
                        CssSpin,
                        { className: 'mt-20', spinning: true, type: 'waves' },
                        React.createElement(
                            'div',
                            { style: { height: 100, position: "relative", backgroundColor: "#ecf6fd", border: "1px solid #d2eafb" } },
                            React.createElement(
                                'strong',
                                null,
                                'Alert message title'
                            ),
                            React.createElement(
                                'p',
                                null,
                                'Further details about the context of this alert.'
                            )
                        )
                    ),
                    React.createElement(
                        GIFSpin,
                        { className: 'mt-20', spinning: true, src: "../../../assets/imgs/loading-icon.gif" },
                        React.createElement(
                            'div',
                            { style: { height: 100, position: "relative", backgroundColor: "#ecf6fd", border: "1px solid #d2eafb" } },
                            React.createElement(
                                'strong',
                                null,
                                'Alert message title'
                            ),
                            React.createElement(
                                'p',
                                null,
                                'Further details about the context of this alert.'
                            )
                        )
                    )
                );
            }
        }]);

        return Page;
    }(Component);

    module.exports = Page;
});
